package com.ailk.bigdata.etl.realstream.server.protocal.sdtp.server.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ailk.bigdata.etl.realstream.server.constant.ProtocalSdtpConstant;
import com.ailk.bigdata.etl.realstream.server.monitor.EventCounter;
import com.ailk.bigdata.etl.realstream.server.protocal.sdtp.netty.handler.ProtocalSdtpAcceptedHandler;
import com.ailk.bigdata.etl.realstream.server.protocal.sdtp.netty.server.ProtocalSdtpDataAcceptServer;

/**
 * 
 * @description sdtp协议数据接收监听线程
 * @author [xuwei3]
 * @version [版本号,2015-11-12]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class SDTPDataAcceptListenThread extends Thread
{
	private static Logger logger = LoggerFactory.getLogger(SDTPDataAcceptListenThread.class);

	private EventCounter eventCounter;

	public SDTPDataAcceptListenThread(EventCounter eventCounter)
	{
		this.eventCounter = eventCounter;
	}

	@Override
	public void run()
	{
		try
		{
			logger.info("实时流数据接收端口监听服务启动PORT[{}].........", ProtocalSdtpConstant.PORT_SDTP_CS_DATA_ACCEPT);
			new ProtocalSdtpDataAcceptServer(ProtocalSdtpConstant.PORT_SDTP_CS_DATA_ACCEPT).run(new ProtocalSdtpAcceptedHandler(eventCounter));
		}
		catch (Exception e)
		{
			logger.error("实时流数据接收端口监听服务启动异常,系统推出登陆", e);
			System.exit(-1);
		}
	}
}
